package com.ccrfid.rmc6.resource.business.entrance;

import com.ccrfid.rmc6.appconfig.auth.Secured;
import com.ccrfid.rmc6.pojo.dto.HardWorkingInfoDto;
import com.ccrfid.rmc6.service.business.entrance.PersonnelEntranceService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Secured
@Path("personnel-entrance")
@Produces(MediaType.APPLICATION_JSON)
public class PersonnelEntranceResource {
    @Autowired
    PersonnelEntranceService personnelEntranceService;

    @GET
    @Path("hardworking-list")
    public List<HardWorkingInfoDto> getPersonnelHardWorkingList(@QueryParam("startDate") String startDate,
                                                                @QueryParam("stopDate") String stopDate) {
        return personnelEntranceService.getPersonnelHardWorkingList(startDate, stopDate);
    }

    @PUT
    @Path("{date}/records")
    public Boolean updatePersonnelEntranceRecords(@PathParam("date") String dateStr) {
        personnelEntranceService.updatePersonnelEntranceRecords(dateStr);
        return true;
    }
}
